﻿Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared
Imports System.Data
Imports MySql.Data
Imports MySql.Data.MySqlClient
Imports System.IO

Public Class prnpackage

    Dim position_user As String
    Public selectedEmployee As String
    Dim idcontainer As String
    Dim mysqlpass As String
    Dim ipconnect As String
    Dim usernamedb As String
    Dim dbname As String
    Dim export_id As String
    Dim id_hn As String

    Dim mysql As MySqlConnection
    Public Sub New(ByRef mysql_pass As String, ByRef ip_connect As String, ByRef user_namedb As String, ByRef db_name As String, ByRef idhn As String, ByRef idexport As String)
        InitializeComponent()
        mysqlpass = mysql_pass
        selectedEmployee = ""
        ipconnect = ip_connect
        usernamedb = user_namedb
        dbname = db_name
        export_id = idexport
        id_hn = idhn

    End Sub

    Dim rpt1 As New reportPackage6


    Dim cryRpt As New ReportDocument
    Private Sub prnpackage_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        rpt1.PrintOptions.PaperSize = PaperSize.PaperA5
        Dim margins As PageMargins
        margins.bottomMargin = 210
        margins.leftMargin = 210
        margins.rightMargin = 210
        margins.topMargin = 210
        rpt1.PrintOptions.ApplyPageMargins(margins)
        default_font()

        CrystalReportViewer1.ReportSource = rpt1


        CrystalReportViewer1.Refresh()

        mysql = New MySqlConnection
        mysql.ConnectionString = "server=" + ipconnect + ";user id=" + usernamedb + ";password=" + mysqlpass + ";database=" + dbname + ";Character Set =utf8;"
        Try
            mysql.Open()
            '    MsgBox("CONNECTED TO DATABASE")
        Catch ex As Exception
            MsgBox("Can't Connect to database" + ex.Message)

            Me.Close()
        End Try


        rpt1.SetParameterValue("doctor_name", frmpackage6.doctor_name)

        If id_hn <> "0" And export_id <> "0" Then
            Dim mySqlCommand As New MySqlCommand
            Dim mySqlAdaptor As New MySqlDataAdapter
            Dim mySqlReader As MySqlDataReader


            If mysql.State = ConnectionState.Closed Then
                mysql.Open()
            End If
            mySqlCommand.CommandText = "Select * from checkup_export where hn like '" + id_hn + "' and checkup_export_id like '" + export_id + "' ;"
            mySqlCommand.Connection = mysql
            mySqlAdaptor.SelectCommand = mySqlCommand

            Try
                mySqlReader = mySqlCommand.ExecuteReader

                While mySqlReader.Read()
                    rpt1.SetParameterValue("name", frmpackage6.name_lastname)
                    If mySqlReader("sex_code") = "3" Then
                        rpt1.SetParameterValue("sex", "หญิง")
                    Else
                        rpt1.SetParameterValue("sex", "ชาย")
                    End If
                  
                    If mySqlReader("R79") Is DBNull.Value Then
                        rpt1.SetParameterValue("group_blood", "-")
                    Else
                        rpt1.SetParameterValue("group_blood", mySqlReader("R79"))
                    End If

                    If mySqlReader("R80") Is DBNull.Value Then
                        rpt1.SetParameterValue("blood_rh", "-")
                    Else
                        rpt1.SetParameterValue("blood_rh", mySqlReader("R80"))

                    End If

                    If mySqlReader("R3") Is DBNull.Value Then
                        rpt1.SetParameterValue("hb", "-")
                    Else
                        rpt1.SetParameterValue("hb", mySqlReader("R3"))

                    End If
                    If mySqlReader("R4") Is DBNull.Value Then
                        rpt1.SetParameterValue("hct", "-")
                    Else

                        rpt1.SetParameterValue("hct", mySqlReader("R4"))

                    End If
                    If mySqlReader("R1") Is DBNull.Value Then
                        rpt1.SetParameterValue("wbc", "-")
                    Else

                        rpt1.SetParameterValue("wbc", mySqlReader("R1"))
                    End If


                    If mySqlReader("R15") Is DBNull.Value Then
                        rpt1.SetParameterValue("atypical", "-")
                    Else
                        rpt1.SetParameterValue("atypical", mySqlReader("R15"))

                    End If

                    If mySqlReader("R14") Is DBNull.Value Then
                        rpt1.SetParameterValue("basophils", "-")
                    Else
                        rpt1.SetParameterValue("basophils", mySqlReader("R14"))
                    End If


                    If mySqlReader("R13") Is DBNull.Value Then
                        rpt1.SetParameterValue("eosinophils", "-")
                    Else

                        rpt1.SetParameterValue("eosinophils", mySqlReader("R13"))
                    End If



                    If mySqlReader("R11") Is DBNull.Value Then
                        rpt1.SetParameterValue("lymphocyte", "-")
                    Else
                        rpt1.SetParameterValue("lymphocyte", mySqlReader("R11"))
                    End If

                    If mySqlReader("R12") Is DBNull.Value Then
                        rpt1.SetParameterValue("monocytes", "-")
                    Else
                        rpt1.SetParameterValue("monocytes", mySqlReader("R12"))
                    End If


                    If mySqlReader("R10") Is DBNull.Value Then
                        rpt1.SetParameterValue("neutrophils", "-")
                    Else
                        rpt1.SetParameterValue("neutrophils", mySqlReader("R10"))
                    End If


                    If mySqlReader("R8") Is DBNull.Value Then
                        rpt1.SetParameterValue("plate_count", "-")
                    Else
                        rpt1.SetParameterValue("plate_count", mySqlReader("R8"))
                    End If

            
                    ' tab3


                    If mySqlReader("R32") Is DBNull.Value Then
                        rpt1.SetParameterValue("urine_color", "-")
                    Else
                        rpt1.SetParameterValue("urine_color", mySqlReader("R32"))
                    End If


                    If mySqlReader("R33") Is DBNull.Value Then
                        rpt1.SetParameterValue("urine_appearance", "-")
                    Else
                        rpt1.SetParameterValue("urine_appearance", mySqlReader("R33"))
                    End If

                    If mySqlReader("R54") Is DBNull.Value Then
                        rpt1.SetParameterValue("urine_glucose", "-")
                    Else
                        rpt1.SetParameterValue("urine_glucose", mySqlReader("R54"))
                    End If


                    If mySqlReader("R41") Is DBNull.Value Then
                        rpt1.SetParameterValue("urine_blood", "-")
                    Else
                        rpt1.SetParameterValue("urine_blood", mySqlReader("R41"))
                    End If

                    If mySqlReader("R35") Is DBNull.Value Then
                        rpt1.SetParameterValue("urine_ph", "-")
                    Else
                        rpt1.SetParameterValue("urine_ph", mySqlReader("R35"))
                    End If


                    If mySqlReader("R44") Is DBNull.Value Then
                        rpt1.SetParameterValue("urine_rbc", "-")
                    Else
                        rpt1.SetParameterValue("urine_rbc", mySqlReader("R44"))
                    End If



                    If mySqlReader("R45") Is DBNull.Value Then
                        rpt1.SetParameterValue("urine_wbc", "-")
                    Else
                        rpt1.SetParameterValue("urine_wbc", mySqlReader("R45"))
                    End If

                    If mySqlReader("R54") Is DBNull.Value Then
                        rpt1.SetParameterValue("fbs", "-")
                    Else
                        rpt1.SetParameterValue("fbs", mySqlReader("54"))

                    End If
                    rpt1.SetParameterValue("result_fbs", frmpackage6.result_fbs)

                    If mySqlReader("R46") Is DBNull.Value Then
                        rpt1.SetParameterValue("urine_epi", "-")
                    Else
                        rpt1.SetParameterValue("urine_epi", mySqlReader("R46"))
                    End If
                    If mySqlReader("R36") Is DBNull.Value Then
                        rpt1.SetParameterValue("urine_albumin", "-")
                    Else
                        rpt1.SetParameterValue("urine_albumin", mySqlReader("R36"))
                    End If
                    If mySqlReader("R34") Is DBNull.Value Then
                        rpt1.SetParameterValue("urine_spgr", "-")
                    Else
                        rpt1.SetParameterValue("urine_spgr", mySqlReader("R34"))
                    End If


                    'tab5
                    If mySqlReader("R55") Is DBNull.Value Then
                        rpt1.SetParameterValue("bun", "-")
                        rpt1.SetParameterValue("result_bun", "-")
                    Else
                        rpt1.SetParameterValue("bun", mySqlReader("R55"))
                    End If

                    If mySqlReader("R57") Is DBNull.Value Then
                        rpt1.SetParameterValue("cholesterol", "-")
                        rpt1.SetParameterValue("result_cholesterol", "-")
                    Else
                        rpt1.SetParameterValue("cholesterol", mySqlReader("R57"))
                    End If

                    If mySqlReader("R56") Is DBNull.Value Then
                        rpt1.SetParameterValue("creatinie", "-")
                        rpt1.SetParameterValue("result_creatinie", "-")
                    Else
                        rpt1.SetParameterValue("creatinie", mySqlReader("R56"))
                    End If




                    If mySqlReader("R59") Is DBNull.Value Then
                        rpt1.SetParameterValue("hdl", "-")
                        rpt1.SetParameterValue("result_hdl", "-")
                    Else
                        rpt1.SetParameterValue("hdl", mySqlReader("R59"))
                    End If
                    rpt1.SetParameterValue("result_hdl", "-")


                    If mySqlReader("R58") Is DBNull.Value Then
                        rpt1.SetParameterValue("trigyceride", "-")
                        rpt1.SetParameterValue("result_trigyceride", "-")

                    Else
                        rpt1.SetParameterValue("trigyceride", mySqlReader("R58"))
                    End If


                    If mySqlReader("R61") Is DBNull.Value Then
                        rpt1.SetParameterValue("uric_acid", "-")
                        rpt1.SetParameterValue("result_uricacid", "-")
                    Else
                        rpt1.SetParameterValue("uric_acid", mySqlReader("R61"))
                    End If


                    'tab6

                    If mySqlReader("R66") Is DBNull.Value Then
                        rpt1.SetParameterValue("afp", "-")
                        rpt1.SetParameterValue("result_afp", "-")
                    Else
                        rpt1.SetParameterValue("afp", mySqlReader("R66"))
                    End If

                    If mySqlReader("R62") Is DBNull.Value Then
                        rpt1.SetParameterValue("alkaline", "-")
                        rpt1.SetParameterValue("result_alkaline", "-")
                    Else
                        rpt1.SetParameterValue("alkaline", mySqlReader("R62"))
                    End If
                    If mySqlReader("R60") Is DBNull.Value Then
                        rpt1.SetParameterValue("ldl", "-")
                        rpt1.SetParameterValue("result_ldl", "-")
                    Else
                        rpt1.SetParameterValue("ldl", mySqlReader("R60"))
                    End If
                    If mySqlReader("R70") Is DBNull.Value Then
                        rpt1.SetParameterValue("sgot", "-")
                        rpt1.SetParameterValue("result_sgot", "-")
                    Else
                        rpt1.SetParameterValue("sgot", mySqlReader("R70"))
                    End If

                    If mySqlReader("R71") Is DBNull.Value Then
                        rpt1.SetParameterValue("sgpt", "-")
                        rpt1.SetParameterValue("result_sgpt", "-")
                    Else
                        rpt1.SetParameterValue("sgpt", mySqlReader("R71"))
                    End If

                    rpt1.SetParameterValue("tell", frmpackage6.tellephone)

                    rpt1.SetParameterValue("physical_exam", frmpackage6.result_physical)
                    rpt1.SetParameterValue("x_ray", frmpackage6.result_xray)
                    rpt1.SetParameterValue("ultrasound", frmpackage6.result_ultrasound)
                    rpt1.SetParameterValue("ekg", frmpackage6.result_ekg)
                    rpt1.SetParameterValue("address", frmpackage6.address)
                    rpt1.SetParameterValue("urine_other", frmpackage6.urine_other)
                    rpt1.SetParameterValue("id_hn", id_hn)
                    rpt1.SetParameterValue("age", mySqlReader("age_y"))
                    rpt1.SetParameterValue("test_date", mySqlReader("export_date"))
                    rpt1.SetParameterValue("height", frmpackage6.phy_height)
                    rpt1.SetParameterValue("weight", frmpackage6.phy_weight)
                    rpt1.SetParameterValue("bmi", frmpackage6.phy_bmi)
                    rpt1.SetParameterValue("pulse_rate", frmpackage6.phy_pulse)
                    rpt1.SetParameterValue("blood_pressure", frmpackage6.phy_bloodpressure)

                    rpt1.SetParameterValue("dental", frmpackage6.phy_dental)
                    rpt1.SetParameterValue("redcell", frmpackage6.tab2_redcell)
                    rpt1.SetParameterValue("result_blood", frmpackage6.result_hematology)
                    rpt1.SetParameterValue("urine_result", frmpackage6.result_urine)
                    rpt1.SetParameterValue("result_bun", frmpackage6.result_bun)
                    rpt1.SetParameterValue("result_creatinine", frmpackage6.result_creatinine)
                    rpt1.SetParameterValue("result_uricacid", frmpackage6.result_uricacid)
                    rpt1.SetParameterValue("result_cholesterol", frmpackage6.result_cholesterol)
                    rpt1.SetParameterValue("result_trigyceride", frmpackage6.result_triglyceride)
                    rpt1.SetParameterValue("result_hdl", frmpackage6.result_hdl)
                    rpt1.SetParameterValue("result_ldl", frmpackage6.result_ldl)
                    rpt1.SetParameterValue("result_sgot", frmpackage6.result_sgot)
                    rpt1.SetParameterValue("result_sgpt", frmpackage6.result_sgpt)
                    rpt1.SetParameterValue("result_alkaline", frmpackage6.result_alkaline)
                    rpt1.SetParameterValue("result_afp", frmpackage6.result_afp)
                    rpt1.SetParameterValue("result_blood", frmpackage6.result_hematology)
                    rpt1.SetParameterValue("urine_result", frmpackage6.result_urine)
                    rpt1.SetParameterValue("result_fbs", frmpackage6.result_fbs)
                    rpt1.SetParameterValue("result_all", frmpackage6.result_all)
                    rpt1.SetParameterValue("right_eye", frmpackage6.phy_eye_right)
                    rpt1.SetParameterValue("left_eye", frmpackage6.phy_eye_left)
                    rpt1.SetParameterValue("result_eye", frmpackage6.result_eye)
                    rpt1.SetParameterValue("result_phy", frmpackage6.result_phy)
                    rpt1.SetParameterValue("under", frmpackage6.under)

                    rpt1.SetParameterValue("psa", frmpackage6.pap_text)
                    rpt1.SetParameterValue("result_psa", frmpackage6.pap_result)
                    rpt1.SetParameterValue("morphology", frmpackage6.red_homology)

                End While
                mysql.Close()

            Catch ex As Exception
                MsgBox(ex.ToString)
            End Try
        Else
            Dim mySqlCommand As New MySqlCommand
            Dim mySqlAdaptor As New MySqlDataAdapter
            Dim mySqlReader As MySqlDataReader


            If mysql.State = ConnectionState.Closed Then
                mysql.Open()
            End If
            mySqlCommand.CommandText = "Select * from checkup_export where hn like '" + id_hn + "' ;"
            mySqlCommand.Connection = mysql
            mySqlAdaptor.SelectCommand = mySqlCommand

            Try
                mySqlReader = mySqlCommand.ExecuteReader

                While mySqlReader.Read()
                    rpt1.SetParameterValue("name", frmpackage6.name_lastname)
                    If mySqlReader("sex_code") = "3" Then
                        rpt1.SetParameterValue("sex", "หญิง")
                    Else
                        rpt1.SetParameterValue("sex", "ชาย")
                    End If
                   

                    If mySqlReader("R79") Is DBNull.Value Then
                        rpt1.SetParameterValue("group_blood", "-")
                    Else
                        rpt1.SetParameterValue("group_blood", mySqlReader("R79"))
                    End If

                    If mySqlReader("R80") Is DBNull.Value Then
                        rpt1.SetParameterValue("blood_rh", "-")
                    Else
                        rpt1.SetParameterValue("blood_rh", mySqlReader("R80"))

                    End If

                    If mySqlReader("R3") Is DBNull.Value Then
                        rpt1.SetParameterValue("hb", "-")
                    Else
                        rpt1.SetParameterValue("hb", mySqlReader("R3"))

                    End If
                    If mySqlReader("R4") Is DBNull.Value Then
                        rpt1.SetParameterValue("hct", "-")
                    Else

                        rpt1.SetParameterValue("hct", mySqlReader("R4"))

                    End If
                    If mySqlReader("R1") Is DBNull.Value Then
                        rpt1.SetParameterValue("wbc", "-")
                    Else

                        rpt1.SetParameterValue("wbc", mySqlReader("R1"))
                    End If


                    If mySqlReader("R15") Is DBNull.Value Then
                        rpt1.SetParameterValue("atypical", "-")
                    Else
                        rpt1.SetParameterValue("atypical", mySqlReader("R15"))

                    End If

                    If mySqlReader("R14") Is DBNull.Value Then
                        rpt1.SetParameterValue("basophils", "-")
                    Else
                        rpt1.SetParameterValue("basophils", mySqlReader("R14"))
                    End If


                    If mySqlReader("R13") Is DBNull.Value Then
                        rpt1.SetParameterValue("eosinophils", "-")
                    Else

                        rpt1.SetParameterValue("eosinophils", mySqlReader("R13"))
                    End If



                    If mySqlReader("R11") Is DBNull.Value Then
                        rpt1.SetParameterValue("lymphocytes", "-")
                    Else
                        rpt1.SetParameterValue("lymphocytes", mySqlReader("R11"))
                    End If

                    If mySqlReader("R12") Is DBNull.Value Then
                        rpt1.SetParameterValue("monocytes", "-")
                    Else
                        rpt1.SetParameterValue("monocytes", mySqlReader("R12"))
                    End If


                    If mySqlReader("R10") Is DBNull.Value Then
                        rpt1.SetParameterValue("neutrophils", "-")
                    Else
                        rpt1.SetParameterValue("neutrophils", mySqlReader("R10"))
                    End If


                    If mySqlReader("R8") Is DBNull.Value Then
                        rpt1.SetParameterValue("plate_count", "-")
                    Else
                        rpt1.SetParameterValue("plate_count", mySqlReader("R8"))
                    End If

                    ' tab3


                    If mySqlReader("R32") Is DBNull.Value Then
                        rpt1.SetParameterValue("urine_color", "-")
                    Else
                        rpt1.SetParameterValue("urine_color", mySqlReader("R32"))
                    End If


                    If mySqlReader("R33") Is DBNull.Value Then
                        rpt1.SetParameterValue("urine_appearance", "-")
                    Else
                        rpt1.SetParameterValue("urine_appearance", mySqlReader("R33"))
                    End If

                    If mySqlReader("R54") Is DBNull.Value Then
                        rpt1.SetParameterValue("urine_glucose", "-")
                    Else
                        rpt1.SetParameterValue("urine_glucose", mySqlReader("R54"))
                    End If


                    If mySqlReader("R41") Is DBNull.Value Then
                        rpt1.SetParameterValue("urine_blood", "-")
                    Else
                        rpt1.SetParameterValue("urine_blood", mySqlReader("R41"))
                    End If

                    If mySqlReader("R35") Is DBNull.Value Then
                        rpt1.SetParameterValue("urine_ph", "-")
                    Else
                        rpt1.SetParameterValue("urine_ph", mySqlReader("R35"))
                    End If


                    If mySqlReader("R44") Is DBNull.Value Then
                        rpt1.SetParameterValue("urine_rbc", "-")
                    Else
                        rpt1.SetParameterValue("urine_rbc", mySqlReader("R44"))
                    End If



                    If mySqlReader("R45") Is DBNull.Value Then
                        rpt1.SetParameterValue("urine_wbc", "-")
                    Else
                        rpt1.SetParameterValue("urine_wbc", mySqlReader("R45"))
                    End If

                    If mySqlReader("R54") Is DBNull.Value Then
                        rpt1.SetParameterValue("fbs", "-")
                    Else
                        rpt1.SetParameterValue("fbs", mySqlReader("R54"))

                    End If
                    rpt1.SetParameterValue("result_fbs", frmpackage6.result_fbs)

                    If mySqlReader("R46") Is DBNull.Value Then
                        rpt1.SetParameterValue("urine_epi", "-")
                    Else
                        rpt1.SetParameterValue("urine_epi", mySqlReader("R46"))
                    End If
                    If mySqlReader("R36") Is DBNull.Value Then
                        rpt1.SetParameterValue("urine_albumin", "-")
                    Else
                        rpt1.SetParameterValue("urine_albumin", mySqlReader("R36"))
                    End If
                    If mySqlReader("R34") Is DBNull.Value Then
                        rpt1.SetParameterValue("urine_spgr", "-")
                    Else
                        rpt1.SetParameterValue("urine_spgr", mySqlReader("R34"))
                    End If

                    'tab5
                    If mySqlReader("R55") Is DBNull.Value Then
                        rpt1.SetParameterValue("bun", "-")
                        rpt1.SetParameterValue("result_bun", "-")
                    Else
                        rpt1.SetParameterValue("bun", mySqlReader("R55"))
                    End If




                    If mySqlReader("R57") Is DBNull.Value Then
                        rpt1.SetParameterValue("cholesterol", "-")
                        rpt1.SetParameterValue("result_cholesterol", "-")
                    Else
                        rpt1.SetParameterValue("cholesterol", mySqlReader("R57"))
                    End If

                    If mySqlReader("R56") Is DBNull.Value Then
                        rpt1.SetParameterValue("creatinine", "-")
                        rpt1.SetParameterValue("result_creatinine", "-")
                    Else
                        rpt1.SetParameterValue("creatinine", mySqlReader("R56"))
                    End If




                    If mySqlReader("R59") Is DBNull.Value Then
                        rpt1.SetParameterValue("hdl", "-")
                        rpt1.SetParameterValue("result_hdl", "-")
                    Else
                        rpt1.SetParameterValue("hdl", mySqlReader("R59"))
                    End If
                    rpt1.SetParameterValue("result_hdl", "-")


                    If mySqlReader("R58") Is DBNull.Value Then
                        rpt1.SetParameterValue("trigyceride", "-")
                        rpt1.SetParameterValue("result_trigyceride", "-")

                    Else
                        rpt1.SetParameterValue("trigyceride", mySqlReader("R58"))
                    End If


                    If mySqlReader("R61") Is DBNull.Value Then
                        rpt1.SetParameterValue("uric_acid", "-")
                        rpt1.SetParameterValue("result_uricacid", "-")
                    Else
                        rpt1.SetParameterValue("uric_acid", mySqlReader("R61"))
                    End If


                    'tab6

                    If mySqlReader("R66") Is DBNull.Value Then
                        rpt1.SetParameterValue("afp", "-")
                        rpt1.SetParameterValue("result_afp", "-")
                    Else
                        rpt1.SetParameterValue("afp", mySqlReader("R66"))
                    End If

                    If mySqlReader("R62") Is DBNull.Value Then
                        rpt1.SetParameterValue("alkaline", "-")
                        rpt1.SetParameterValue("result_alkaline", "-")
                    Else
                        rpt1.SetParameterValue("alkaline", mySqlReader("R62"))
                    End If
                    If mySqlReader("R60") Is DBNull.Value Then
                        rpt1.SetParameterValue("ldl", "-")
                        rpt1.SetParameterValue("result_ldl", "-")
                    Else
                        rpt1.SetParameterValue("ldl", mySqlReader("R60"))
                    End If
                    If mySqlReader("R70") Is DBNull.Value Then
                        rpt1.SetParameterValue("sgot", "-")
                        rpt1.SetParameterValue("result_sgot", "-")
                    Else
                        rpt1.SetParameterValue("sgot", mySqlReader("R70"))
                    End If

                    If mySqlReader("R71") Is DBNull.Value Then
                        rpt1.SetParameterValue("sgpt", "-")
                        rpt1.SetParameterValue("result_sgpt", "-")
                    Else
                        rpt1.SetParameterValue("sgpt", mySqlReader("R71"))
                    End If
                    rpt1.SetParameterValue("tell", frmpackage6.tellephone)

                    rpt1.SetParameterValue("physical_exam", frmpackage6.result_physical)
                    rpt1.SetParameterValue("x_ray", frmpackage6.result_xray)
                    rpt1.SetParameterValue("ultrasound", frmpackage6.result_ultrasound)
                    rpt1.SetParameterValue("ekg", frmpackage6.result_ekg)
                    rpt1.SetParameterValue("address", frmpackage6.address)
                    rpt1.SetParameterValue("urine_other", frmpackage6.urine_other)
                    rpt1.SetParameterValue("id_hn", id_hn)
                    rpt1.SetParameterValue("age", mySqlReader("age_y"))
                    rpt1.SetParameterValue("test_date", mySqlReader("export_date"))
                    rpt1.SetParameterValue("height", frmpackage6.phy_height)
                    rpt1.SetParameterValue("weight", frmpackage6.phy_weight)
                    rpt1.SetParameterValue("bmi", frmpackage6.phy_bmi)
                    rpt1.SetParameterValue("pulse_rate", frmpackage6.phy_pulse)
                    rpt1.SetParameterValue("blood_pressure", frmpackage6.phy_bloodpressure)

                    rpt1.SetParameterValue("dental", frmpackage6.phy_dental)
                    rpt1.SetParameterValue("redcell", frmpackage6.tab2_redcell)
                    rpt1.SetParameterValue("result_blood", frmpackage6.result_hematology)
                    rpt1.SetParameterValue("urine_result", frmpackage6.result_urine)
                    rpt1.SetParameterValue("result_bun", frmpackage6.result_bun)
                    rpt1.SetParameterValue("result_creatinine", frmpackage6.result_creatinine)
                    rpt1.SetParameterValue("result_uricacid", frmpackage6.result_uricacid)
                    rpt1.SetParameterValue("result_cholesterol", frmpackage6.result_cholesterol)
                    rpt1.SetParameterValue("result_trigyceride", frmpackage6.result_triglyceride)
                    rpt1.SetParameterValue("result_hdl", frmpackage6.result_hdl)
                    rpt1.SetParameterValue("result_ldl", frmpackage6.result_ldl)
                    rpt1.SetParameterValue("result_sgot", frmpackage6.result_sgot)
                    rpt1.SetParameterValue("result_sgpt", frmpackage6.result_sgpt)
                    rpt1.SetParameterValue("result_alkaline", frmpackage6.result_alkaline)
                    rpt1.SetParameterValue("result_afp", frmpackage6.result_afp)
                    rpt1.SetParameterValue("result_blood", frmpackage6.result_hematology)
                    rpt1.SetParameterValue("urine_result", frmpackage6.result_urine)
                    rpt1.SetParameterValue("result_fbs", frmpackage6.result_fbs)
                    rpt1.SetParameterValue("result_all", frmpackage6.result_all)
                    rpt1.SetParameterValue("right_eye", frmpackage6.phy_eye_right)
                    rpt1.SetParameterValue("left_eye", frmpackage6.phy_eye_left)
                    rpt1.SetParameterValue("result_eye", frmpackage6.result_eye)
                    rpt1.SetParameterValue("result_phy", frmpackage6.result_phy)

                    rpt1.SetParameterValue("psa", frmpackage6.pap_text)
                    rpt1.SetParameterValue("result_psa", frmpackage6.pap_result)
                    rpt1.SetParameterValue("morphology", frmpackage6.red_homology)
                    rpt1.SetParameterValue("under", frmpackage6.under)
                End While
                mysql.Close()

            Catch ex As Exception
                MsgBox(ex.ToString)
            End Try




        End If
    End Sub


    Public Sub default_font()
        rpt1.SetParameterValue("name", " ")
        rpt1.SetParameterValue("test_date", " ")
        rpt1.SetParameterValue("id_hn", " ")
        rpt1.SetParameterValue("age", " ")
        rpt1.SetParameterValue("sex", " ")
        rpt1.SetParameterValue("address", " ")
        rpt1.SetParameterValue("tell", " ")
        rpt1.SetParameterValue("under", " ")
        rpt1.SetParameterValue("height", " ")
        rpt1.SetParameterValue("weight", " ")
        rpt1.SetParameterValue("bmi", " ")
        rpt1.SetParameterValue("pulse_rate", " ")
        rpt1.SetParameterValue("blood_pressure", " ")
        rpt1.SetParameterValue("result_phy", " ")
        rpt1.SetParameterValue("dental", " ")
        rpt1.SetParameterValue("group_blood", " ")
        rpt1.SetParameterValue("blood_rh", " ")
        rpt1.SetParameterValue("hb", " ")
        rpt1.SetParameterValue("hct", " ")
        rpt1.SetParameterValue("wbc", " ")
        rpt1.SetParameterValue("neutrophils", " ")
        rpt1.SetParameterValue("lymphocytes", " ")
        rpt1.SetParameterValue("eosinophils", " ")
        rpt1.SetParameterValue("result_fbs", " ")
        rpt1.SetParameterValue("result_bun", " ")
        rpt1.SetParameterValue("monocytes", " ")
        rpt1.SetParameterValue("basophils", " ")
        rpt1.SetParameterValue("atypical", " ")
        rpt1.SetParameterValue("redcell", " ")
        rpt1.SetParameterValue("plate_count", " ")
        rpt1.SetParameterValue("result_blood", " ")
        rpt1.SetParameterValue("urine_color", " ")
        rpt1.SetParameterValue("urine_appearance", " ")
        rpt1.SetParameterValue("urine_albumin", " ")
        rpt1.SetParameterValue("urine_glucose", " ")
        rpt1.SetParameterValue("urine_spgr", " ")
        rpt1.SetParameterValue("urine_blood", " ")
        rpt1.SetParameterValue("urine_ph", " ")
        rpt1.SetParameterValue("urine_wbc", " ")
        rpt1.SetParameterValue("urine_other", " ")
        rpt1.SetParameterValue("urine_result", " ")
        rpt1.SetParameterValue("urine_epi", " ")
        rpt1.SetParameterValue("urine_rbc", " ")
        rpt1.SetParameterValue("physical_exam", " ")
        rpt1.SetParameterValue("x_ray", " ")
        rpt1.SetParameterValue("ultrasound", " ")
        rpt1.SetParameterValue("ekg", " ")
        rpt1.SetParameterValue("fbs", " ")
        rpt1.SetParameterValue("result_creatinine", " ")
        rpt1.SetParameterValue("result_uricacid", " ")
        rpt1.SetParameterValue("cholesterol", " ")
        rpt1.SetParameterValue("result_cholesterol", " ")
        rpt1.SetParameterValue("trigyceride", " ")
        rpt1.SetParameterValue("result_trigyceride", " ")
        rpt1.SetParameterValue("hdl", " ")
        rpt1.SetParameterValue("result_hdl", " ")
        rpt1.SetParameterValue("ldl", " ")
        rpt1.SetParameterValue("result_ldl", " ")
        rpt1.SetParameterValue("sgot", " ")
        rpt1.SetParameterValue("result_sgot", " ")
        rpt1.SetParameterValue("sgpt", " ")
        rpt1.SetParameterValue("result_sgpt", " ")
        rpt1.SetParameterValue("alkaline", " ")
        rpt1.SetParameterValue("result_alkaline", " ")
        rpt1.SetParameterValue("result_all", " ")
        rpt1.SetParameterValue("afp", " ")
        rpt1.SetParameterValue("result_afp", " ")
        rpt1.SetParameterValue("psa", " ")
        rpt1.SetParameterValue("result_psa", " ")
        rpt1.SetParameterValue("left_eye", " ")
        rpt1.SetParameterValue("right_eye", " ")
        rpt1.SetParameterValue("morphology", " ")
        rpt1.SetParameterValue("under", " ")
        rpt1.SetParameterValue("bun", " ")
        rpt1.SetParameterValue("creatinine", " ")
        rpt1.SetParameterValue("uric_acid", " ")
        rpt1.SetParameterValue("result_eye", " ")
    End Sub
    Private Sub CrystalReportViewer1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CrystalReportViewer1.Load

    End Sub
End Class